home *** CD-ROM | disk | FTP | other *** search
- //////////////////////////
- // Harrow Software 1996
- // Object examples
-
- //////////////////////////
- // (1) Copy an object
-
- object_one = new struct
- $object_one.name = "Edward\n"
- object_two = copy object_one
- message $object_two.name
-
- //////////////////////////////
- // (2) Test for a valid object
-
- object_one = new struct
- if valid object_one then message "The object is valid"
- else message "The object is not valid"
-
- free object_one
- if valid object_one then message "The object is valid"
- else message "The object is not valid"
-
- object_one = new struct
- object_two = object_one
- if valid object_two then message "The object is valid"
- else message "The object is not valid"
-
- //////////////////////////////
- // (3) Comparing two objects
-
- message "\nCompare the same object"
-
- object_one = new struct
- object_two = object_one
- if @object_one == @object_one then message "Two objects are equal"
- if @object_one != @object_one then message "Two objects are not equal"
-
- message "\nCompare different objects"
-
- object_two = new struct
- if @object_one == @object_two then message "Two objects are equal"
- if @object_one != @object_two then message "Two objects are not equal"
-
- message "\nCompare assigned objects"
-
- object_two = object_one
- if @object_one == @object_two then message "Two objects are equal"
- if @object_one != @object_two then message "Two objects are not equal"
-
- message "\nCompare copied objects"
-
- object_two = copy object_one
- if @object_one == @object_two then message "Two objects are equal"
- if @object_one != @object_two then message "Two objects are not equal"
-